/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.manage.core.processor.store;

import cn.hutool.core.lang.Assert;
import info.peigen.hotpot.common.core.result.ResultCode;
import info.peigen.hotpot.common.service.base.exception.BusinessException;
import info.peigen.hotpot.common.service.base.processor.Processor;
import info.peigen.hotpot.common.service.base.processor.ProcessorServiceContext;
import info.peigen.hotpot.manage.core.domain.Position;
import info.peigen.hotpot.manage.core.service.processor.AbstractHotpotManageServiceProcessor;
import org.noear.solon.annotation.Component;

/**
 * <b>(PositionStoreProcessor)</b>
 * "职位" 存储处理器
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2024-06-22
 */
@SuppressWarnings("rawtypes")
@Component
public class PositionStoreProcessor extends AbstractHotpotManageServiceProcessor implements Processor {
    @Override
    public Integer level() {
        return 90;
    }

    @Override
    public void execute(ProcessorServiceContext serviceContext) {
        Position domain = (Position) serviceContext.getDomain();
        Assert.notNull(domain, () -> new BusinessException(ResultCode.FAILURE, "领域对象不存在!"));
        positionRepository.store(domain);
    }

}